package com.mzy.olddate.demo.tree;

import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2021/8/3 22:42
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {
        Node dennis = new Node(1, 0, "dennis");
        Node calm = new Node(2, 0, "calm");
        Node daughter = new Node(3, 1, "daughter");
        Node grandson = new Node(4, 3, "grandson");
        Node son = new Node(5, 2, "son");
        Node 皇上 = new Node(5, 4, "皇上");
//        List<Node> nodes = Lists.newArrayList(dennis, calm, daughter, son, grandson,皇上);
        ArrayList<Node> objects = new ArrayList<>();
        objects.add(dennis);
        objects.add(calm);
        objects.add(daughter);
        objects.add(grandson);
        objects.add(son);
        objects.add(皇上);

        List<Node> tree = TreeUtil.buildTree(objects);
        System.out.println(JSON.toJSONString(tree));
    }
}